package com.multiblock.service.impl;

import com.multiblock.dao.UserDao;
import com.multiblock.entity.User;
import com.multiblock.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service("userService")
public class UserServiceImpl implements UserService {

    @Autowired
    private UserDao userDao;

    @Override
    public Integer add(User user) {
        return userDao.insert(user);
    }

    @Override
    public Integer del(Integer id) {
        return userDao.deleteByPrimaryKey(id);
    }

    @Override
    public Integer update(User user) {
        return userDao.updateByPrimaryKey(user);
    }

    @Override
    public User load(Integer id) {
        return userDao.selectByPrimaryKey(id);
    }

    @Override
    public List<User> list() {
        return userDao.selectAll();
    }

}